<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>健康上报记录管理</title>
    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="bootstrap/js/bootstrap.js" type="text/javascript"></script>
    <link rel="stylesheet" href="bootstrap/css/bootstrap.css">
    <script src="layui/layui.js"></script>
    <link rel="stylesheet" href="layui/css/layui.css">
    <style>
        body{
            margin-top: 0;
            padding: 30px;
        }
    </style>
</head>
<body>
<ol class="breadcrumb">
    <li><a href="/mainbg">主页</a></li>
    <li><a href="#">健康上报记录管理</a></li>
</ol>
    <div id="pointInfo" class="container-fluid">
        <div class="panel panel-success">
            <div class="panel-heading">健康上报记录</div>
            <input type="hidden" name="id" th:value="${session.user.id}">
            <input type="hidden" name="pageNo" id="pageNo" th:value="${pageInfo.pageNum}" >
            <input type="hidden" name="pageSize" id="pageSize" th:value="${pageInfo.pageSize}">
            <input type="hidden" id="pageTotal" th:value="${pageInfo.total}">
            <table class="table table-bordered table-striped table-hover" style="margin-top: 10px">
                <thead>
                <tr class="info">
                    <th>id</th>
                    <th>咳嗽(y咳嗽/n不咳嗽)</th>
                    <th>体温(体温是否大于37.3度，y是，n不是)</th>
                    <th>出发地</th>
                    <th>到达地</th>
                    <th>详细地址</th>
                    <th>上报时间</th>
                </tr>
                </thead>
                <tbody>
<!--                <tr th:if="${HealthDeclarationRecord.size()==0||HealthDeclarationRecord==null}">-->
<!--                    <td colspan="5" style="text-align: center;font-size: 18px;color: red">暂无健康上报记录</td>-->
<!--                </tr>-->
                <tr th:each="Healthreport:${healthDeclarationRecordVos}">
                    <td th:text="${Healthreport.id}"></td>
                    <td th:text="${Healthreport.cough}"></td>
                    <td th:text="${Healthreport.temperature}"></td>
                    <td th:text="${Healthreport.departureArea}"></td>
                    <td th:text="${Healthreport.arrivalArea}"></td>
                    <td th:text="${Healthreport.address}"></td>
                    <td th:text="${#dates.format(Healthreport.reportingtime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                </tr>
                </tbody>
            </table>
        <div id="pageDemo"></div>
    </div>
</div>

<script type="text/javascript" src="js/layuiDateForMate.js"></script>
<script type="text/javascript">
    function timeOutReflush() {
        setTimeout(function () {
            window.location.href='HealthDeclarationRecord?pageNo='+$('#pageNo').val()+'&pageSize='+$('#pageSize').val();
        },1500);
    }
    function addReservation(iSiteAndVacc) {   //弹出修改框并插入数据
        console.log(iSiteAndVacc);
        var iSiteAndVacc=eval("("+iSiteAndVacc+")");   //将json转化成对象
        console.log(typeof iSiteAndVacc);
        $("#ivId").val(iSiteAndVacc.id);
        $("#vaccinesid").val(iSiteAndVacc.vaccinesid);
        $("#Healthreportid").val(iSiteAndVacc.Healthreportid);
        $("#vaccinesname").val(iSiteAndVacc.vaccinesname);
        $("#Healthreportname").val(iSiteAndVacc.Healthreportname);
        $("#startTimeU").val(translaDate(iSiteAndVacc.starttime));
        $("#endTimeU").val(translaDate(iSiteAndVacc.endtime));
    }
    function addReservation2() {
        $.ajax({
            url: '/addReservation',
            type: 'post',
            data: $("#addReservationForm").serialize(),
            success: function (result) {
                console.log(result);
                if(result=='SUCCESS'){   //修改成功
                    layer.msg("预约成功",{icon:1});
                    timeOutReflush();
                }else{   //登录失败
                    layer.alert('预约失败,请注意时间是否在可预约时间段!',{icon:2});
                }
            }
        });
        return false;
    }
</script>
<script type="text/javascript">
    layui.use(['laypage', 'layer'], function(){
        var laypage = layui.laypage
            ,layer = layui.layer;
        var form = layui.form;
        var layer = layui.layer;
        var util = layui.util;

        let pageNo=parseInt($('#pageNo').val());
        let pageSize=parseInt($('#pageSize').val());
        let pageTotal=parseInt($('#pageTotal').val());

        //完整功能
        laypage.render({
            elem: 'pageDemo'
            ,count: pageTotal
            ,curr: pageNo
            ,limit: pageSize
            ,limits: [5,10,20,30,50]
            ,layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
            ,jump: function(obj,first){
                console.log(obj);
                if(!first){
                    //do something
                    $('#pageNo').val(obj.curr);
                    $('#pageSize').val(obj.limit);
                    $('#formId').submit();
                    console.log("pageNo="+obj.curr+",pageSize="+obj.limit);
                    location.href="HealthDeclarationRecord?pageNo="+obj.curr+"&pageSize="+obj.limit;
                }
            }
        });
    });
</script>
</body>
</html>